<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>JS事件</title>
    </head>
    <body>
        <button onclick="click_event()">这是一个点击事件按钮</button>
        <input type="text" onfocus="focus_event()" onblur="blur_event()">
        <script>
            //点击事件
            function click_event(){
                alert("点击事件触发了");
            }

            //聚焦事件
            function focus_event(){
                console.log("获取焦点");
            }

            //失去焦点
            function blur_event(){
                console.log("失去焦点");
            }
        </script>
    </body>
</html>